package com.tdx.blog_nowcoder.utils;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;

public class CookieUtil {
    public static String getValue(HttpServletRequest request,String ticketName){
        Cookie[] cookies = request.getCookies();
        if(cookies!=null){
            for (Cookie cookie:cookies){
                if(cookie.getName().equals(ticketName)){
                    return cookie.getValue();
                }
            }
        }

        return null;
    }
}
